<?php 
	echo $this->element('reportcss');
	$file_name = "常熟领军人才".$year."年引进项目统计表";
	if(empty($report)){?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2><?php echo $file_name;?></h2>
	</div>
    <?php
    	echo '<div class="right back_btn">';
		echo $html->link("导出报表","/reports/talentimportreport/1?year=".$year);
		echo '</div>';
	?> 
	 <div class="form_sx_drop right">
    	<?php 
    		$years=$str->getafteryear(0);
    		echo $form->select('ddlyear',$years, $year, null,null);
		?>
	</div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
 <?php }?>
 			<?php 
        		if(!empty($report)){
        			echo "<div align='center'><h3>$file_name</h3></div>";
        		}
        	?>
        	<table border='1'>
            	<tr>
            		<th>序号</th>
                    <th>公司名称</th>
                    <th>注册时间</th>
		 			<th>注册资本（万元）</th>
		 			<th>项目名称</th>
		 			<th>人才姓名</th>
		 			<th>性别</th>
		 			<th>出生年月</th>
		 			<th>国籍</th>
		 			<th>毕业院校</th>
		 			<th>学历学位</th>
		 			<th>备注</th>
                </tr>
		 		<?php 
		 			$i = 1;
					foreach($projects as $project)
					{
						$j = 0;
						$pid = $project["Project"]["id"];
						$cname = $project["Project"]["company_name"];//单位名称
		 				$contact = $project["Project"]["contact"];//人才姓名
		 				$sex = $project["Project"]["sex"];//性别
		 				if($sex == 0)
		 					$sex = "男";
		 				else 
		 					$sex = "女";
		 				$birthday = "";
		 				$bir = $project["Project"]["birthday"];
		 				if($bir)
		 					$birthday = date("Y.m",strtotime($bir));//出生年月
		 				$nation = $project["Project"]["nation"];//国籍
		 				$pname = $project["Project"]["project_name"];//项目名称
		 				$graduate_school = $project["Project"]["graduate_school"];//毕业院校
		 				$education = "";
		 				$edu = $project["Project"]["education"];
		 				if(!empty($edu))
		 					$education = $education_array[$edu];//学历学位
		 				$reg_time = date("Y-m-d",strtotime($project["Project"]["reg_time"]));//注册时间
		 				$cap_type = $project["Project"]["cap_type"];
		 				$capital = $project["Project"]["capital"];
		 				if($cap_type == 1)
		 					$capital .= "(美元)";
		 					
		 				classregistry::init('SearchCompany')->bindModel(
							array('hasMany' => array(
								'CompTalent' => array (
						    		'conditions' => array("CompTalent.is_deleted='0' and CompTalent.type_id in ($idlist)"),
									'className' => 'CompTalent',
									'fields'=>'CompTalent.declare_time,CompTalent.type_id',
									'foreignKey' => 'cid'
								)
							))
						);
						$company = classregistry::init('SearchCompany')->findByPid($pid);//企业的ID

		 				//人才信息
		 				$talents = $company["CompTalent"];
		 				$talents_num = count($talents);
		 				$statement = "";
		 				if($talents)
		 				{
		 					foreach($talents as $talent)
			 				{
			 					$declare_time = date("Y",strtotime($talent["declare_time"]));//申报的年份
			 					$tvalue=$talent['type_id'];
								classregistry::init('Talstack')->tname="";
								classregistry::init('Talstack')->showtname($tvalue);
								$tname=rtrim(classregistry::init('Talstack')->tname,"/");
								$beizhu = "";
								$beizhu .= $declare_time.$tname;
							
								echo "<tr>";
			 					if($j == 0)
			 					{
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($i)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($cname)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($reg_time)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($capital)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($pname)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($contact)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($sex)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($birthday)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($nation)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($graduate_school)."</td>";
					 				echo "<td align='center' rowspan='".$talents_num."'>".$str->formatCell($education)."</td>";
					 				
			 					}
			 					
			 					echo "<td align='center' >".$str->formatCell($beizhu)."</td>";
			 					$j++;
			 					echo "</tr>";
			 				} 
			 				
		 				}
		 				else 
		 				{
 								echo "<tr>";
								echo "<td align='center'>".$str->formatCell($i)."</td>";
				 				echo "<td align='center'>".$str->formatCell($cname)."</td>";
				 				echo "<td align='center'>".$str->formatCell($reg_time)."</td>";
				 				echo "<td align='center'>".$str->formatCell($capital)."</td>";
				 				echo "<td align='center'>".$str->formatCell($pname)."</td>";
				 				echo "<td align='center'>".$str->formatCell($contact)."</td>";
				 				echo "<td align='center'>".$str->formatCell($sex)."</td>";
				 				echo "<td align='center'>".$str->formatCell($birthday)."</td>";
				 				echo "<td align='center'>".$str->formatCell($nation)."</td>";
				 				echo "<td align='center'>".$str->formatCell($graduate_school)."</td>";
				 				echo "<td align='center'>".$str->formatCell($education)."</td>";
				 				echo "<td align='center' >-</td>";
				 				echo "</tr>";
		 				}
		 				$i++;
					}
		 		?>
            </table>
<?php if(empty($report)){?>
		</div>
    </div>
</div>
<script>
var webpath=$("#getpath").attr('href');
var urlpath=webpath+"reports/talentimportreport/?seach=all";
$(document).ready(function(){
	$("#ddlyear").change(function() {  
		searchproject();
	});
});
function searchproject()
{	
	var year = $("#ddlyear").val();
	if( year=="" ){
		window.location.href=urlpath;
	}else{
		if(year.trim() != ""){
			urlpath+="&year="+year.trim();
		}
		window.location.href=urlpath;
	}
	return false;
}
</script>
<?php }?>
